const TerserPlugin = require("terser-webpack-plugin");
module.exports = (base) => {
  base.optimization = {
    minimize: true, // 是否压缩
    minimizer: [
      new TerserPlugin({
        // test: /\.js(\?.*)?$/i,
        // minify: TerserPlugin.terserMinify, //9603 ms
        // minify: TerserPlugin.uglifyJsMinify, //14799 ms
        minify: TerserPlugin.swcMinify,//  5387 ms
        // minify: TerserPlugin.esbuildMinify, //4902 ms
        terserOptions: {},
      }),
    ],
  };
};
